package com.yunhe.serviceImpl;

import com.yunhe.javabean.Product;
import com.yunhe.mapper.ProductMapper;
import com.yunhe.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("productService")
public class ProductServiceImpl implements ProductService {
    @Autowired
    ProductMapper productMapper;
    @Override
    public List<Product> findAll(String productName) {
        return productMapper.selectAll(productName);
    }

    @Override
    public Product findById(Integer id) {

        return productMapper.selectById(id);
    }

    @Override
    public int editById(Product product) {
        return productMapper.updateById(product);
    }

    @Override
    public int add(Product product) {
        return productMapper.insert(product);
    }

    @Override
    public int delete(Integer id) {
        return productMapper.delete(id);
    }

    @Override
    public int deleteIds(List<Integer> ids) {
        return productMapper.deleteByList(ids);
    }
}
